module game {
	/**
	 * 分页滑动基类：分激活状态与静止状态
	 * @author caizj
	 *
	 */
	export class BaseSwiper extends egret.DisplayObjectContainer{
        
        private static shockSound: egret.Sound;
        private static bgSound: egret.Sound;
        protected isActive: boolean=true;//默认必须为true
		public constructor() {
            super();
            this.deactivate();
		}
        
        /**
        * 激活模式：用于滑入屏幕后显示【静止效果转为动态】
        * 
        */
        public activate(): void { 
            this.isActive = true;
        }
        
        /**
        * 静止模式：用于滑出屏幕后处理【动态效果转为静态】
        * 
        */
        public deactivate(): void { 
            this.isActive = false;
        }
        
        /**
        * 创建位图
        * 
        */
        protected createBitmapByName(name:string):egret.Bitmap {
            var result:egret.Bitmap = new egret.Bitmap();
            var texture:egret.Texture = RES.getRes(name);
            result.texture = texture;
            return result;
        }
        
        protected onTweenOver(obj:any): void {
            egret.Tween.removeTweens(obj);
        }
        
        /**
        * 播放震撼入场音效
        * 
        */
        protected playSound(resName:string="shock"): void { 
            if(resName == "shock") {
                if(BaseSwiper.shockSound == null) {
                    BaseSwiper.shockSound = RES.getRes("shock_sound");
                }
                BaseSwiper.shockSound.play(false);
            } else { 
                if(BaseSwiper.bgSound == null) {
                     BaseSwiper.bgSound = RES.getRes("bg_sound");
                }
                BaseSwiper.bgSound.play(true);
            }
        }
	}
}
